# -*- coding: utf-8 -*-
# @Time : 2023/11/23 14:09
# @Author : 支晓光
# @Email : 1473858993@qq.com
# @File : parame_utils.py
# @Project : YouGuuUII

import csv
import os.path
import yaml
from openpyxl import load_workbook
from common.handler_path import xlsx_dir, yaml_dir, csv_dir


# 读取yaml文件  返回字典格式
def read_yaml_dict(filename):
    # 进行路径拼接，兼容系统操作
    filepath = os.path.join(yaml_dir, filename)
    # 打开yaml文件        # 只读 # utf8编码格式，支持中文
    file = open(filepath, 'r+', encoding='utf8')
    # 读取yaml文件数据
    data = yaml.safe_load(file.read())
    # 返回yaml数据
    return data


def read_csv(filename):
    filepath = os.path.join(csv_dir, filename)
    file = open(filepath, 'r+', encoding='utf8')
    data = csv.reader(file)
    l = []
    for line in data:
        l.append(line)
    l.pop(0)
    return l


    # 调试信息
    # print(dy.getdata())
    # print(DataUtil().)
    # print(DataUtil().read_yaml_dict('yaml.yaml'))